package com.china.produce.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/5/22
 */
public class CarTimeInvocationHandler implements InvocationHandler {

    private MoveAble moveable;

    public CarTimeInvocationHandler(MoveAble moveable)
    {
        this.moveable = moveable;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Object o = method.invoke(moveable, args);

        System.out.println(Arrays.toString(proxy.getClass().getDeclaredFields()));

        return o;
    }
}
